//1.检查日期是否有效
const isDateValid = (...val) => !Number.isNaN(new Date(...val).valueOf());
console.log(isDateValid('December 17, 2022 08:22:00'));

// 2.计算两个日期之间的间隔              Math.ceil(向上取整) Math.abs(绝对值)
const dayDif = (date1,date2) => Math.ceil(Math.abs(date1.getTime()-date2.getTime())/86400000);
console.log(dayDif(new Date('2022-8-3'),new Date('2023-8-3')));
